﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using System.Web.Routing;
using Microsoft.Owin;
using Microsoft.Owin.Host.SystemWeb;
using RestSharp;
using Ymatou.ServiceCenter;
namespace WebApiDemoOwinSelfHost.Controller
{
    public class TestController : ApiController
    {
        // GET: api/Default

        public IEnumerable<string> Get()
        {
            string clientIp = Request.GetClientIp();
            string serverIpLink = Request.GetServerIpLink();
           
            return new string[] { "value1", "value2" };
        }
        [ServiceRegister("api/Test", Method.GET)]
        // GET: api/Default/5
        public string Get(int id)
        {
           
            WebApplicationDemo2.Contract.EmptyRequest request = new WebApplicationDemo2.Contract.EmptyRequest();
            WebApplicationDemo2.Contract.EmptyResponse response = ServiceClient.Execute<WebApplicationDemo2.Contract.EmptyRequest, 
                WebApplicationDemo2.Contract.EmptyResponse>(request, null, 100000, Request.GetServiceClientRequestHeader());

            return "value";
        }

        // POST: api/Default
        public void Post([FromBody]string value)
        {
        }

        // PUT: api/Default/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE: api/Default/5
        public void Delete(int id)
        {
        }
    }
}
